//
//  UIView+wgData.m
//  WGTool
//
//  Created by czw on 2022/8/19.
//

#import "UIView+wgData.h"
#import <objc/runtime.h>

static const char kUIViewDataKey;

@implementation UIView (wgData)

@dynamic data;

- (void)setData:(id)data
{
    [self wg_dataWillChange];
    objc_setAssociatedObject(self, &kUIViewDataKey, data, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    [self wg_dataDidChange];
}

- (id)data
{
    return objc_getAssociatedObject(self, &kUIViewDataKey);
}

- (void)wg_dataDidChange
{
    // to implement
}

- (void)wg_dataWillChange
{
    // to implement
}

@end

